home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / em-xmkit.zip / EMM21_B.ASM < prev    next >
Assembly Source File  |  1989-11-29  |  5KB  |  101 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM21_B.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   search_handle_name                                      ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function searches the handle name directory for a  ;
  7. ;                     handle with a particular name.  When it finds a handle  ;
  8. ;                     name, this function returns the handle number           ;
  9. ;                     associated with the name.  At the time of installation, ;
  10. ;                     all handles have their names initialized to ASCII       ;
  11. ;                     nulls.  By definition, a handle thus initialized has    ;
  12. ;                     no name.  To name a handle, make at least one           ;
  13. ;                     character in the name a non-null character (to          ;
  14. ;                     distinguish it from a handle without a name.)           ;
  15. ;                                                                             ;
  16. ;           PASSED:   &handle_name:                                           ;
  17. ;                        is a far pointer to a structure which contains the   ;
  18. ;                        name that is to be assigned to the handle.  The      ;
  19. ;                        structure member is described here:                  ;
  20. ;                                                                             ;
  21. ;                        name:                                                ;
  22. ;                           is an array of chars that holds the handle's      ;
  23. ;                           name.  If the name is less than eight characters  ;
  24. ;                           long, you must add nulls to make it eight         ;
  25. ;                           characters.                                       ;
  26. ;                                                                             ;
  27. ;                     &handle:                                                ;
  28. ;                        is a far pointer to the handle which matches the     ;
  29. ;                        handle name specified.                               ;
  30. ;                                                                             ;
  31. ;         RETURNED:   status:                                                 ;
  32. ;                        is the status EMM returns from the call.  All other  ;
  33. ;                        returned results are valid only if the status        ;
  34. ;                        returned is zero.  Otherwise they are undefined.     ;
  35. ;                                                                             ;
  36. ;                     handle:                                                 ;
  37. ;                        is the handle which matches the handle name          ;
  38. ;                        specified.                                           ;
  39. ;                                                                             ;
  40. ; C USE CONVENTION:   unsigned int       status;                              ;
  41. ;                     unsigned int       handle;                              ;
  42. ;                     HANDLE_NAME_STRUCT handle_name;                         ;
  43. ;                                                                             ;
  44. ;                     status = search_handle_name (&handle_name,              ;
  45. ;                                                  &handle);                  ;
  46. ;-----------------------------------------------------------------------------;
  47. .XLIST
  48. PAGE    60,132
  49.  
  50. IFDEF SMALL
  51.    .MODEL SMALL, C
  52. ENDIF
  53. IFDEF MEDIUM
  54.    .MODEL MEDIUM, C
  55. ENDIF
  56. IFDEF LARGE
  57.    .MODEL LARGE, C
  58. ENDIF
  59. IFDEF COMPACT
  60.    .MODEL COMPACT, C
  61. ENDIF
  62. IFDEF HUGE
  63.    .MODEL HUGE, C
  64. ENDIF
  65.  
  66. INCLUDE emmlib.equ
  67. INCLUDE emmlib.str
  68. INCLUDE emmlib.mac
  69. .LIST
  70. .CODE
  71.  
  72. search_handle_name    PROC                                                  \
  73.             USES DS SI,                                           \
  74.             ptr_handle_name:FAR PTR BYTE,                             \
  75.             ptr_handle:FAR PTR WORD
  76.  
  77.     ;---------------------------------------------------------------------;
  78.     ;   do;                                                               ;
  79.     ;   .   search for a handle with a specified name in the "directory"; ;
  80.     ;---------------------------------------------------------------------;
  81.     MOVE        AX, search_for_named_handle_fcn
  82.     MOVE        DS:SI, ptr_handle_name
  83.     INT         EMM_int
  84.  
  85.     ;---------------------------------------------------------------------;
  86.     ;   .   pass the handle value matching the handle name back to the    ;
  87.     ;  .    caller;                                                       ;
  88.     ;---------------------------------------------------------------------;
  89.     MOVE        ES:BX, ptr_handle
  90.     MOVE        ES:[BX], DX
  91.  
  92.     ;---------------------------------------------------------------------;
  93.     ;   .   return (EMM status);                                          ;
  94.     ;   end;                                                              ;
  95.     ;---------------------------------------------------------------------;
  96.     RET_EMM_STAT    AH
  97.  
  98. search_handle_name    ENDP
  99.  
  100. END
  101.